<?php

/**
 * Created by PhpStorm.
 * User: zuoa
 * Date: 2016/11/21 0021
 * Time: 09:56
 */
class Preset_Model extends CI_Model
{
    private $table_name = "tbl_preset_police";

    public function __construct()
    {
        $this->load->database();
    }

    public function is_preset($idcard, $name)
    {
        $query = $this->db->get_where($this->table_name, array("idcard" => $idcard, "name" => $name, "active"=>1));
        return $query->first_row() != null;
    }

    public function deactive($idcard)
    {
        $data = array(
            'active' => 0
        );

        $this->db->update($this->table_name, $data, array('idcard' => $idcard));
    }
}